<%@Application Language="C#" %>
<%@import namespace="System" %>
<%@import namespace="My.Web.Handler" %>
<%@import namespace="My.Application.Cms" %>
<script runat="server">
    
    protected void Application_Start(Object sender, EventArgs e) 
    {
        Application["cms"] = new CmsHandler( "Test_Cms_Categories","Test_Cms_Articles","Test_Cms_Comments" );
        Application["blog"] = Application["cms"];
        Application["account"] = new AccountHandler( "Test_Accounts" );
        
        Application["guestId"] = new CmsIdentity( "guest","adminmm666" );

    }
    protected void Session_Start(Object sender, EventArgs e) 
    {
        //Session["startValue"] = 0;
    }
    
    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
        string oldUrl = HttpContext.Current.Request.RawUrl;
        //HttpContext.Current.Response.Write( oldUrl );
        // string pattern = @"^(.+)default/(\d+)\.aspx(\?.*)*___FCKpd___0";
        // string replace = "$1default.aspx?id=$2";
        // if(Regex.IsMatch(oldUrl, pattern, RegexOptions.IgnoreCase|RegexOptions.Compiled))
        // {
        //     string newUrl = Regex.Replace(oldUrl, pattern, replace, RegexOptions.Compiled |
        //     RegexOptions.IgnoreCase);
        //     this.Context.RewritePath(newUrl);
        // }
    }
</script>